package com.jcl.recruit.searchresume.service;

import com.jcl.recruit.searchresume.logic.SearchResumeRecordLogic;
import com.jcl.recruit.searchresume.model.SearchResumeRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class SearchResumeRecordService {

    @Autowired
    private SearchResumeRecordLogic searchResumeRecordLogic;

    public List<SearchResumeRecord> selectSearchResumeRecord(Integer userId,
                                                             String keyword,
                                                             String city,
                                                             String education,
                                                             Integer workYear,
                                                             Integer wechatPush,
                                                             Integer emailPush) {
        return searchResumeRecordLogic.selectSearchResumeRecord(userId, keyword, city, education, workYear, wechatPush, emailPush);
    }

    public List<SearchResumeRecord> selectSearchResumeRecordByUserId(Integer userId) {
        return searchResumeRecordLogic.selectSearchResumeRecordByUserId(userId);
    }

    public SearchResumeRecord selectSearchResumeRecordById(Integer id) {
        return searchResumeRecordLogic.selectSearchResumeRecordById(id);
    }

    public List<SearchResumeRecord> selectWechatPushRecordByUserId(Integer userId) {
        return searchResumeRecordLogic.selectWechatPushRecordByUserId(userId);
    }

    public int insertSelective(SearchResumeRecord record) {
        return searchResumeRecordLogic.insertSelective(record);
    }

    public int updateByPrimaryKeySelective(SearchResumeRecord record) {
        return searchResumeRecordLogic.updateByPrimaryKeySelective(record);
    }

    public int deleteSearchResumeRecordById(Integer id) {
        return searchResumeRecordLogic.deleteSearchResumeRecordById(id);
    }

    public String selectKeywordByCrawing(String from) {
        return searchResumeRecordLogic.selectKeywordByCrawing(from);
    }

    public List<SearchResumeRecord> selectListsByKeyword(String keyword) {
        return searchResumeRecordLogic.selectListsByKeyword(keyword);
    }

    public int batchUpdate(List<SearchResumeRecord> list) {
        return searchResumeRecordLogic.batchUpdate(list);
    }

    public SearchResumeRecord selectPrimaryKeyByKeywordAndUpdatime(String date, String keyword) {
        SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd");
        return searchResumeRecordLogic.selectPrimaryKeyByKeywordAndUpdatime(sdf.format(new Date()), keyword);
    }

    public int batchUpdateCrawing(Date time) {
        return searchResumeRecordLogic.batchUpdateCrawing(time);
    }
}
